# range
# 用来创建一个序列

# print(list(range(11)))
# print(list(range(0, 10)))
# print(list(range(1, 10)))
# print(list(range(1, 10, 2)))

# for loop in [100, 200, 300]:
#     print(loop)
#
#
# for loop in range(10):  # 0~9
#     print(loop)

# 多参数循环

# lst = [
#     [0, 1],
#     [1, 2],
#     [4, 5]
# ]
#
# for a, b in lst:
#     print(a, b)

# i = [1, 2]
# a, b, c = [1, 2, 3]  # 解包
#
# print(i)
#
# print(a)
# print(b)
# print(c)

# 如何循环一个列表/元组
# lst = [1, 2, 3, 4]
# for el in lst:
#     print(el)
#
# print(len(lst))
# print(range(len(lst)))  # 0, 1, 2, 3
#
# for idx in range(len(lst)):
#     if lst[idx] == 2:
#         lst[idx] = 123
#
# print(lst)

# print(list(enumerate(lst)))
#
# for idx, el in enumerate(lst):  # 借助多参数循环的思想，不难看出enumerate产出的是((下标1, 元素1), (下标2, 元素2))
#     print(idx, el)
